<template>
  <intro-view :usage="usage">
    <ui-scroll>
      <input type="file" name="image" accept="image/*" style="font-size: 1.2em; padding: 10px 0;" @change="setImage" />
      <ui-img-cropper :srcFile.sync="srcFile" :croppedFile.sync="croppedFile" :aspectRatio="4/3">
        <div>请选择文件</div>
      </ui-img-cropper>
      <img :src="croppedFile" alt="Cropped Image" />
    </ui-scroll>
  </intro-view>
</template>

<script>
  import usage from './usage.md'
  export default {
    data () {
      return {
        usage,
        srcFile: '',
        croppedFile: ''
      }
    },
    methods: {
      setImage(e) {
        this.srcFile = e.target.files[0]
      }
    }
  }
</script>

<style lang="scss" scoped>
</style>
